package edu.wit.acl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.wit.acl.entity.RoleProject;
import edu.wit.acl.mapper.RoleProjectMapper;
import edu.wit.acl.service.RoleProjectService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class RoleProjectServiceImpl extends ServiceImpl<RoleProjectMapper, RoleProject> implements RoleProjectService {
    @Override
    public List<String> selectProjectIdsByRoleId(String roleId) {
        List<RoleProject> projects=baseMapper.selectList(new QueryWrapper<RoleProject>().eq("role_id",roleId));
        List<String> projectIds=new ArrayList<>();
        projects.forEach(project->{
            projectIds.add(project.getProjectId()+"");
        });
        return projectIds;
    }
}
